//
//  PersonInfoViewController.m
//  com.modada.new
//
//  Created by ferver7 on 2019/5/8.
//  Copyright © 2019 ferver7. All rights reserved.
//

#import "PersonInfoViewController.h"

@interface PersonInfoViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *logoImage;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;

@end

@implementation PersonInfoViewController
-(void)outLoginAction:(UIButton *)sender
{
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"摩嗒嗒提醒您" message:@"是否退出用户登录" preferredStyle: UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        //点击按钮的响应事件；
        
    }]];
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [self.navigationController popToRootViewControllerAnimated:NO];
        [[NSNotificationCenter defaultCenter] postNotificationName:@"appUserOutLogin" object:nil];
    }]];
    //弹出提示框；
    [self presentViewController:alert animated:true completion:nil];
   
}
- (void)viewDidLoad {
    [super viewDidLoad];
    mNavitationTitle(@"个人信息");
    [self customNavigationItems];
    self.view.backgroundColor = [UIColor AxcUI_colorWithHexCode:@"#ebebeb"];
     AppUserBaseModel * appModel = [AppUserBaseModel sharedUserData];
    self.nameLabel.text = appModel.storeName;
    [self.logoImage sd_setImageWithURL:[NSURL URLWithString:appModel.doorImage] placeholderImage:mImageByName(@"")];
    self.phoneLabel.text = appModel.phone;
    self.addressLabel.text = appModel.detailedAddress;
    
    UIView * tabeleFooter = [[UIView alloc]initWithFrame:CGRectMake(0, 0, mScreenWidth, 200)];
    tabeleFooter.backgroundColor = [UIColor clearColor];
    
    UILabel *lab = [[UILabel alloc]initWithFrame:CGRectMake(0, 4, KScreenWidth, 33)];
    lab.text = @"*用户信息不能修改,需要修改请联系平台";
    lab.textColor = [UIColor redColor];
    lab.font = [UIFont systemFontOfSize:14];
    lab.textAlignment = NSTextAlignmentCenter;
    [tabeleFooter addSubview:lab];
    
    UIButton * outLoginBtn = [[UIButton alloc]initWithFrame:CGRectMake(25, 33+33, mScreenWidth-50, 44)];
    outLoginBtn.backgroundColor = [UIColor AxcUI_colorWithHexColor:@"#6933DB"];
    [outLoginBtn setTitle:@"退出登录" forState:UIControlStateNormal];
    outLoginBtn.titleLabel.font = mTitleFont(14);
    [outLoginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [outLoginBtn addTarget:self action:@selector(outLoginAction:) forControlEvents:UIControlEventTouchUpInside];
    outLoginBtn.layer.masksToBounds = YES;
    outLoginBtn.layer.cornerRadius = 5;
    [tabeleFooter addSubview:outLoginBtn];
    self.tableView.tableFooterView = tabeleFooter;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Incomplete implementation, return the number of sections
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
    return 4;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 15;
}
/*
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath];
    
    // Configure the cell...
    
    return cell;
}
*/

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
